{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            {if condition="empty($data)"}
            <div class="layui-form-item">
                <label class="layui-form-label">所属父级</label>
                <div class="layui-input-inline">
                    <select lay-verify="required|pid" lay-filter="brickType" id="pid" name="pid" lay-search>
                        <option value="0">默认顶级</option>
                        {foreach name="admin_rule" item="v"}
                        <option value="{$v.id}" style="margin-left:55px;">{$v.lefthtml}{$v.title}</option>
                        {/foreach}
                    </select>
                </div>
            </div>
            {/if}
            <div class="layui-form-item">
                <label class="layui-form-label">菜单名称</label>
                <div class="layui-input-inline">
                    <input lay-verify="required|title" type="text" name="title" value="{$data.title|default=''}" autocomplete="off"
                           placeholder="请输入菜单名称" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">节点</label>
                <div class="layui-input-inline">
                    <input lay-verify="required|name" type="text" name="name" value="{$data.name|default=''}" autocomplete="off"
                           placeholder="模块/控制器/方法名" class="layui-input">
                    <span class="help-block m-b-none">如：admin/user/adduser (一级节点添加“#”即可)</span>
                </div>
            </div>

            <div class="layui-form-item" pane>
                <label class="layui-form-label">菜单显示？</label>
                <div class="layui-input-block">
                    <input type="radio" name="type" value="1" title="是" {if condition="isset($data) and $data.type eq 1"}checked{/if} checked>
                    <input type="radio" name="type" value="0" title="否" {if condition="isset($data) and $data.type eq 0"}checked{/if} >
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">icon</label>
                <div class="layui-input-inline">
                    <input type="text" name="icon" value="{$data.icon|default=''}" autocomplete="off"
                           placeholder="请输入样式名称" class="layui-input">
                    <span class="help-block m-b-none"> <a href="https://www.layui.com/doc/element/icon.html"
                                                          target="_black"><i style="color: blue;">选择图标 </i></a> 如:layui-icon-username</span>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">排序</label>
                <div class="layui-input-block">
                    <input type="text" name="sort" value="{$data.sort|default='0'}" autocomplete="off"
                           class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="add" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>

{/block}
{block name="js"}
